.TH std::chrono::weekday_indexed::weekday_indexed 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::chrono::weekday_indexed::weekday_indexed \- std::chrono::weekday_indexed::weekday_indexed

.SH Synopsis
   weekday_indexed() = default;                                       \fB(1)\fP \fI(since C++20)\fP
   constexpr weekday_indexed( const std::chrono::weekday& wd,         \fB(2)\fP \fI(since C++20)\fP
   unsigned index ) noexcept;

   Constructs a weekday_indexed.

   1) Default constructor leaves both the std::chrono::weekday and the index value
   uninitialized.
   2) Constructs a weekday_indexed storing the weekday wd and the index index. The
   values held are unspecified if !wd.ok() || index > 7.

.SH Notes

   A more convenient way to construct a weekday_indexed is with weekday's operator[],
   i.e., wd[index].

.SH Example


// Run this code

 #include <chrono>
 #include <iostream>
 using namespace std::chrono;

 int main()
 {
     constexpr auto third_friday = weekday_indexed(Friday, 3); // uses constructor (2)
     static_assert(third_friday == Friday[3]);

     weekday_indexed wdi = Tuesday[2]; // represents the 2nd Tuesday
     std::cout << year_month_day{ wdi / October / 2019y } << '\\n';
 }

.SH Possible output:

 2019-10-08

.SH See also

              convenience syntax for constructing a weekday_indexed or weekday_last
   operator[] from this weekday
              \fI(public member function of std::chrono::weekday)\fP
